package com.sywb.chuangyebao.lifecycle;

import android.app.Application;
import android.content.Context;
import android.support.v4.app.FragmentManager;

import org.bining.footstone.integration.ConfigModule;
import org.bining.footstone.mvp.AppDelegate;

import java.util.List;

/**
 * app的全局配置信息在此配置,需要将此实现类声明到AndroidManifest中
 * <meta-data android:name="com.sywb.chuangyebao.lifecycle.GlobalConfiguration"
 * android:value="ConfigModule"/>
 */
public class GlobalConfiguration implements ConfigModule {

    @Override
    public void injectAppLifecycle(Context context, List<AppDelegate.Lifecycle> lifecycles) {
        // AppDelegate.Lifecycle 的所有方法都会在基类Application对应的生命周期中被调用,所以在对应的方法中可以扩展一些自己需要的逻辑
        lifecycles.add(new AppLifecycleCallbackImpl());
    }

    @Override
    public void injectActivityLifecycle(Context context, List<Application.ActivityLifecycleCallbacks> lifecycles) {
        lifecycles.add(new ActivityLifecycleCallbackImpl());

    }

    @Override
    public void injectFragmentLifecycle(Context context, List<FragmentManager.FragmentLifecycleCallbacks> lifecycles) {
        // lifecycles.add(new FragmentLifecycleCallbackImpl());
    }

}
